package com.woniu.controller;

import com.woniu.entity.TimeSlot;
import com.woniu.service.TimeSlotService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/time")
public class TimeSlotController {
    @Resource
    private TimeSlotService timeSlotService;
    @GetMapping("/findByDoctorId/{doctorId}")
    public ResponseUtil findByDoctorId(@PathVariable Integer doctorId) {
        return timeSlotService.findByDoctorId(doctorId);
    }
    @PutMapping("/updateTimeSlot/{id}")
    public ResponseUtil updateTimeSlot(@PathVariable Integer id) {
        return timeSlotService.updateTimeSlot(id);
    }



    @GetMapping("/findAll")
    public ResponseUtil findAll(@RequestParam(defaultValue = "1") Integer pageNum,@RequestParam(defaultValue = "10") Integer pageSize){
        return timeSlotService.findAll(pageNum,pageSize);
    }
    @PostMapping("/del/{id}")
    public ResponseUtil deleteByPrimaryKey(@PathVariable Integer id){
        return timeSlotService.deleteByPrimaryKey(id);
    }
    @PostMapping("/insert")
    public ResponseUtil insert(@RequestBody TimeSlot record){
        return timeSlotService.insert(record);
    }
}
